Add proxy and user_agent labels to user login counter metric - #60239
Conversation
|
How can we ensure that an attacker doesn't break cloud monitoring by spamming tons of agents and causing Prometheus to fail? Are we going to drop them in cloud? |
rosstimothy
left a comment
There was a problem hiding this comment.
Agree with Tiago, this seems like it could be a very high cardinality metric. cc @evanfreed.
There was a problem hiding this comment.
I think the concern about high cardinality on the user agent is worth addressing for scalability reasons, even if authenticated users could likely already cause trouble by connecting many agent versions (which we already record).
Could we parse the user agent for Teleport major version, and only accept reasonable values?
@tigrato in order to do that, you need a user from the cluster and must complete the login process. We would probably need to reset counters periodically as well |
Replaced Sprintf with string concatenation
cbec0d8 to
3cc147e
Compare
|
I’ve added a periodic cleanup (hourly) and implemented the label separation by type and version as proposed by @evanfreed. |
|
Any other suggestions or concerns regarding this PR? cc: @tigrato @rosstimothy @evanfreed @hugoShaka |
|
@evanfreed do you have any concerns about consuming this metric in Cloud? |
Login counter metric should not be exported.
With the recent adjustments we should be good. Appreciate keeping an eye out for that. |
|
@rosstimothy could you please take a look on addressed changes aa9f142 |
CR changes
c074d8f to
54a8560
Compare
54a8560 to
cb31dbc
Compare
* Added user login counter metrics labels with proxy information and user-agent version * Fixed defining default user-agent when `extraHeaders` map was nil Replaced Sprintf with string concatenation * Fix the env proxy group ID * Add periodic clean up and change label for the metric * Use `ProxyGroupID` from the proxy configuration. Login counter metric should not be exported. * Namespace new metric CR changes * Removed global constants and changed help message * Comments adjustment
…#61622) * Added user login counter metrics labels with proxy information and user-agent version * Fixed defining default user-agent when `extraHeaders` map was nil Replaced Sprintf with string concatenation * Fix the env proxy group ID * Add periodic clean up and change label for the metric * Use `ProxyGroupID` from the proxy configuration. Login counter metric should not be exported. * Namespace new metric CR changes * Removed global constants and changed help message * Comments adjustment
In this PR, added a user agent to the client tools request header. During login, it is passed through the proxy to the auth service. Additionally, information about the public proxy address is included so it can be recorded in metrics.
The
user_login_totalcounter now has two labels: proxy and user_agent.proxy_group_idlabel allows us to track which regions are used by customers during login.user_agent_typeandversionlabel helps identify the client tools version in use, to detect any affected versions in future, and monitor the progress of client tools managed updates.Example:
Related: